package practice.p1;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
            //1.建立连接
            ServerSocket serverSocket=new ServerSocket(10086);
            //2.获取连接对象
            Socket socket = serverSocket.accept();
            //3.获取输入流对象
            InputStream inputStream = socket.getInputStream();
            InputStreamReader inputStreamReader=new InputStreamReader(inputStream);
            //4.写入数据
            int num;
            while ((num = inputStreamReader.read()) != -1) {
                System.out.print((char) num);
            }

    }
}
